fix: DESCRIBE PAGE recurses into ScrollContainer / TabControl children#271
Conversation
parseRawWidget walked children via the Widgets[] array on every container, but two widget types store their children elsewhere: - ScrollContainer holds children under CenterRegion.Widgets (Mendix 9+). A fallback to the top-level Widgets remains for older BSON shapes. - TabControl holds children under TabPages[].Widgets. The parser now emits a synthetic Pages$TabPage intermediate widget per tab, with the tab name and caption preserved, so DESCRIBE output distinguishes which tab each nested widget belongs to. Before this fix every widget nested inside those two containers was invisible in DESCRIBE PAGE output, creating silent gaps for any downstream tooling (e.g. Python-based widget ID extractors used by test-impact analysis). Closes hjotha's review of mendixlabs#219 (same idea, rewritten against current main after the `parseRawWidget`/`outputWidgetMDLV3` signature refactor; `tabcontainer`/`tabpage` already exist in the grammar, so the describe output round-trips back through `mxcli exec`). `scrollcontainer` has no grammar keyword yet — it is output-only for now; grammar addition is a follow-up. Credit to @NikolaSimsic for identifying the original bug in mendixlabs#219 and for the CenterRegion.Widgets / TabPages[].Widgets field insight. Tests - parseRawWidget: ScrollContainer with CenterRegion, ScrollContainer legacy-Widgets fallback, TabControl with multiple TabPages (name and child widgets preserved per tab). - outputWidgetMDLV3: ScrollContainer header, TabControl + TabPage + Caption emission. - Bug-test MDL script at `mdl-examples/bug-tests/219-scrollcontainer-tabcontrol-describe.mdl` round-trips through `mxcli check`.
AI Code ReviewWhat Looks Good
RecommendationApprove the PR. The fix is correct, well-tested, and maintains backward compatibility while resolving the silent gaps in DESCRIBE PAGE output for ScrollContainer and TabControl containers. The planned grammar addition for Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
PR #271 Review — fix: DESCRIBE PAGE recurses into ScrollContainer / TabControl childrenOverviewClean, focused fix for the silent widget-tree gap in DESCRIBE PAGE. What's Good
Minor NotesAppearance extraction duplicated between ScrollContainer and TabControl handlers
Tab page appearance properties not extracted VerdictLGTM. The core fix is correct and well-tested. The minor duplication items are polish, not correctness issues. |
Summary
DESCRIBE PAGEwalks the widget tree by recursing intoWidgets[]on every container, but two widget types store their children elsewhere:CenterRegion.Widgets(Mendix 9+). A fallback to the top-levelWidgetsis kept for older BSON shapes.TabPages[].Widgets. The parser now emits a syntheticPages$TabPageintermediate widget per tab, with the tab name and caption preserved, so the DESCRIBE output distinguishes which tab each nested widget belongs to.Before this fix every widget nested inside those two containers was invisible in DESCRIBE PAGE output, creating silent gaps for any downstream tooling that relied on DESCRIBE to build a widget-ID-to-page map.
Relationship to #219
This PR is a reimplementation of #219 against the current
main. Since #219 was opened theparseRawWidget/outputWidgetMDLV3signatures were refactored ((e *Executor)method → free function taking*ExecContext), andtabcontainer/tabpagekeywords landed in the MDL grammar. Changes vs #219:*ExecContextAPI.tabcontainer/tabpage/scrollcontaineroutput to match the current MDL convention.Pages$TabPageas an intermediate node with tab name and caption (Update parsing of ScrollContainer and TabControl #219 collapsed tab structure, losing the grouping — flagged by @ako in the Update parsing of ScrollContainer and TabControl #219 review).tabcontainer/tabpagealready exist in the grammar, so the DESCRIBE output round-trips throughmxcli exec.scrollcontainerhas no grammar keyword yet; this PR outputs it for DESCRIBE but does not make it re-executable. Grammar addition is a clean follow-up.mdl-examples/bug-tests/reproducer.Credit to @NikolaSimsic for identifying the original bug in #219 and for the
CenterRegion.Widgets/TabPages[].Widgetsfield insight. Once this merges, #219 can be closed.Test plan
mdl/executor/cmd_pages_describe_container_test.go:parseRawWidget: ScrollContainer via CenterRegion, ScrollContainer legacy-Widgets fallback, TabControl with multiple TabPages (names + child widgets preserved per tab).outputWidgetMDLV3: scroll container header, tab container + tab page + caption emission.mdl-examples/bug-tests/219-scrollcontainer-tabcontrol-describe.mdlround-trips throughmxcli check.go build ./... && go test ./...pass.